<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="/static/bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">
    <script src="/static/jquery-1.11.3.min.js"></script>
    <script src="/static/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
    <style>
        .b{
            border: 1px solid red;
        }
    </style>
    <script>

        $(function () {

            $('#exampleInputEmail1').blur(function () {
                var email = $(this).val();
                var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;

                var label = $(this).prev("label");
                var div = $(this).closest("div");
                label.removeClass("text-success").removeClass("text-danger");
                div.removeClass("has-success").removeClass("has-error");

                if(reg.test(email)){
                    label.addClass("text-success");
                    label.text("邮箱");
                    div.addClass("has-success");
                }else{

                    label.addClass("text-danger");
                    label.text("邮箱格式不正确");
                    div.addClass("has-error");
                }

            })
        })
    </script>
</head>
<body>
<div class="row">
    <div class="col-md-6 b">

        <div class="container">
            <form>
                <div class="form-group">
                    <label for="exampleInputEmail1"  >邮箱</label>
                    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
                </div>
                <div class="form-group">
                    <label for="exampleInputPassword1">密码</label>
                    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
                </div>
                <div class="form-group">
                    <label for="exampleInputFile">File input</label>
                    <input type="file" id="exampleInputFile">
                    <p class="help-block">Example block-level help text here.</p>
                </div>
                <div class="checkbox">
                    <label>
                        <input type="checkbox"> Check me out
                    </label>
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            </form>
        </div>
    </div>
    <div class="col-md-6 b">.col-md-6</div>
</div>


</body>
</html>